/**
 * Created by DELL on 2016/12/22.
 */

var maxProfit = function(prices) {
    var max = 0;
    var len = prices.length;
    for(var i = 1;i < len;i++ ){
        if(prices[i] > prices[i-1]){
            max = max +(prices[i]-prices[i-1]);
        }
    }
    return max;
};